package com.celesea.framework.dao;

import com.celesea.framework.entity.BaseEntity;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.PostConstruct;

/**
 * ${DESCRIPTION}
 *
 * @author JackYuan
 * @create 2017-10-25 17:55
 */

public abstract class AbstractBaseDao<T extends BaseEntity>
        extends SqlSessionDaoSupport
        implements BaseDao<T> {

    @Autowired
    protected SqlSessionTemplate sqlSessionTemplate;
    @Autowired
    protected SqlSessionFactory sqlSessionFactory;

    @PostConstruct
    public void initSqlSessionTemplate() {
        super.setSqlSessionTemplate(sqlSessionTemplate);
        super.setSqlSessionFactory(sqlSessionFactory);
    }
}
